package com.example;

public class Calculator {

    public static double add(double a, double b) {
        return a + b;
    }

    public static double subtract(double a, double b) {
        return a - b;
    }

    public static double multiply(double a, double b) {
        return a * b;
    }

    public static double divide(double a, double b) {
        if (b == 0) {
            throw new IllegalArgumentException("除数不能为零");
        }
        return a / b;
    }

    public static void displayFunctions() {
        System.out.println("\n=== 计算器功能 ===");
        System.out.println("1. 加法运算: add(a, b)");
        System.out.println("2. 减法运算: subtract(a, b)");
        System.out.println("3. 乘法运算: multiply(a, b)");
        System.out.println("4. 除法运算: divide(a, b)");
    }
}